import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/GoldCoinRecharge'
  },
  {
    path: '/UserServiceAgreement', //心动30S用户协议
    name: 'UserServiceAgreement',
    component: resolve => require(['@/views/UserServiceAgreement.vue'], resolve),
    meta: {
      title: '心动30秒用户协议'
    }
  },
  {
    path: '/ServiceAgreement', //心动30S服务协议
    name: 'ServiceAgreement',
    component: resolve => require(['@/views/ServiceAgreement.vue'], resolve),
    meta: {
      title: '心动30秒服务协议'
    }
  },
  {
    path: '/PrivacyAgreement', //隐私协议
    name: 'PrivacyAgreement',
    component: resolve => require(['@/views/PrivacyAgreement.vue'], resolve),

    meta: {
      title: '隐私协议'
    }
  },
  {
    path: '/CommonProblem', //常见问题
    name: 'CommonProblem',
    component: resolve => require(['@/views/CommonProblem.vue'], resolve),
    meta: {
      title: '常见问题'
    }
  },
  {
    path: '/WithdrawalServiceAgreement', //提现服务协议
    name: 'WithdrawalServiceAgreement',
    component: resolve => require(['@/views/WithdrawalServiceAgreement.vue'], resolve),

    meta: {
      title: '提现服务协议'
    }
  },
  {
    path: '/RechargeServiceAgreement', //充值须知
    name: 'RechargeServiceAgreement',
    component: resolve => require(['@/views/RechargeServiceAgreement.vue'], resolve),
    meta: {
      title: '充值须知'
    }
  },
  {
    path: '/CancellationAccount', //注销账户
    name: 'CancellationAccount',
    component: resolve => require(['@/views/CancellationAccount.vue'], resolve),
    meta: {
      title: '注销账户'
    }
  },
  {
    path: '/Jump', //支付宝跳转
    name: 'Jump',
    component: resolve => require(['@/views/Jump.vue'], resolve),

    meta: {
      title: '支付宝跳转'
    }
  },
  {
    path: '/JumpB', //支付宝跳转
    name: 'JumpB',
    component: resolve => require(['@/views/JumpB.vue'], resolve),
    meta: {
      title: '支付宝跳转'
    }
  },
  {
    path: '/UserGuideMan', //用户引导男
    name: 'UserGuideMan',
    component: resolve => require(['@/views/UserGuideMan.vue'], resolve),
    meta: {
      title: '用户引导'
    }
  },
  {
    path: '/UserGuideFemale', //用户引导女
    name: 'UserGuideFemale',
    component: resolve => require(['@/views/UserGuideFemale.vue'], resolve),
    meta: {
      title: '用户引导'
    }
  },
  {
    path: '/ReputationValue', //提高信誉值
    name: 'ReputationValue',
    component: resolve => require(['@/views/ReputationValue.vue'], resolve),
    meta: {
      title: '提高信誉值'
    }
  },
  {
    path: '/InviteFriendsFemale', //邀好友享收益女
    name: 'InviteFriendsFemale',
    component: resolve => require(['@/views/InviteFriendsFemale.vue'], resolve),
    meta: {
      title: '邀请好友赚宝石'
    }
  },

  {
    path: '/InviteFriendsMan', //邀好友领金币男
    name: 'InviteFriendsMan',
    component: resolve => require(['@/views/InviteFriendsMan.vue'], resolve),
    meta: {
      title: '邀请好友赚金币'
    }
  },
  {
    path: '/WebWithdrawal', //提现H5
    name: 'WebWithdrawal',
    component: resolve => require(['@/views/WebWithdrawal.vue'], resolve),
    meta: {
      title: '宝石提现'
    }
  },
  {
    path: '/WithdrawalMethod', //提现方式
    name: 'WithdrawalMethod',
    component: resolve => require(['@/views/WithdrawalMethod.vue'], resolve),
    meta: {
      title: '提现方式'
    }
  },
  {
    path: '/GemWithdrawal', //宝石提现
    name: 'GemWithdrawal',
    component: resolve => require(['@/views/GemWithdrawal.vue'], resolve),
    meta: {
      title: '宝石提现'
    }
  },
  {
    path: '/GoldCoinRecharge', //金币充值
    name: 'GoldCoinRecharge',
    component: resolve => require(['@/views/GoldCoinRecharge.vue'], resolve),
    meta: {
      title: '金币充值'
    }
  },
  {
    path: '/MarketJump', //市场跳转
    name: 'MarketJump',
    component: resolve => require(['@/views/MarketJump.vue'], resolve),
    meta: {
      title: '下载'
    }
  },
  {
    path: '/Login', //登陆跳转
    name: 'Login',
    component: resolve => require(['@/views/Login.vue'], resolve),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/Goldrecord', //金币记录
    name: 'Goldrecord',
    component: resolve => require(['@/views/Goldrecord.vue'], resolve),
    meta: {
      title: '金币记录'
    }
  },
  {
    path: '/TopUpSuccess', //充值成功
    name: 'TopUpSuccess',
    component: resolve => require(['@/views/TopUpSuccess.vue'], resolve),
    meta: {
      title: '充值成功'
    }
  },
  {
    path: '/CommunityConvention', //30秒交友社区公约
    name: 'CommunityConvention',
    component: resolve => require(['@/views/CommunityConvention.vue'], resolve),
    meta: {
      title: '交友社区公约'
    }
  },
  {
    path: '/GoddessGrowth', //女神成长计划
    name: 'GoddessGrowth',
    component: resolve => require(['@/views/GoddessGrowth.vue'], resolve),
    meta: {
      title: '女神成长计划'
    }
  },
  {
    path: '/GoddessCreationCamp', //心动女神创造营
    name: 'GoddessCreationCamp',
    component: resolve => require(['@/views/GoddessCreationCamp.vue'], resolve),
    meta: {
      title: '心动女神创造营'
    }
  },
  {
    path: '/testgetToken', //心动女神创造营
    name: 'testgetToken',
    component: resolve => require(['@/views/testgetToken.vue'], resolve),
    meta: {
      title: '测试'
    }
  },
  {
    path: '/YouMengLink', //渠道下载
    name: 'YouMengLink',
    component: resolve => require(['@/views/YouMengLink.vue'], resolve),
    meta: {
      title: '下载'
    }
  },
  {
    path: '/SecondJump', //渠道下载
    name: 'SecondJump',
    component: resolve => require(['@/views/SecondJump.vue'], resolve),

    meta: {
      title: '下载'
    }
  },
  {
    path: '/Active', //招募活动
    name: 'Active',
    component: resolve => require(['@/views/Active.vue'], resolve),
    meta: {
      title: '招募'
    }
  },
  // {
  //   path: '/vipOpen',
  //   name: 'VipOpen',
  //   component: resolve => require(['@/views/VipOpen.vue'], resolve),

  //   meta: {
  //     title: 'Vip开通'
  //   }
  // },
  {
    path: '/vipCenter',
    name: 'VipCenter',
    component: resolve => require(['@/views/VipCenter.vue'], resolve),

    meta: {
      title: 'Vip中心'
    }
  },
  {
    path: '/aboutHeartbeat',
    name: 'AboutHeartbeat',
    component: resolve => require(['@/views/AboutHeartbeat.vue'], resolve),

    meta: {
      title: '关于心动值'
    }
  },
  {
    path: '/authenticatedUser',
    name: 'AuthenticatedUser',
    component: resolve => require(['@/views/AuthenticatedUser.vue'], resolve),
    meta: {
      title: '认证用户'
    }
  },
  //ExchangeCoins
  {
    path: '/ExchangeCoins',
    name: 'ExchangeCoins',
    component: resolve => require(['@/views/ExchangeCoins.vue'], resolve),
    // component: () => import('@/views/ExchangeCoins.vue'),
    meta: {
      title: '兑金币'
    }
  },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

// 解决报错
const originalPush = VueRouter.prototype.push
const originalReplace = VueRouter.prototype.replace
// push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}
// replace
VueRouter.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject)
  return originalReplace.call(this, location).catch(err => err)
}


export default router